
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);//search,查询？后面的参数，并匹配正则
     if(r!=null)return  unescape(r[2]); return null;
}
var code = GetQueryString("code");
if(code){
  jQuery.ajax({
    url: 'https://api-shake.xinglongdayuan.com/ol/shake/code2login/DJEHBSUAAY',
    dataType: 'jsonp',
    data: {
        "code": code
    },
    jsonp: 'callback',
    success: function (data) {
      console.log(data)
      setCookie('newopenid',data.data.openid)
      location.href ='https://shake.xinglongdayuan.com/queenActivity.html'
    },
    error: function (data) {
      console.log(data)
    }
  })
}
function setCookie(name,value) 
{ 
    var Days = 30; 
    var exp = new Date(); 
    exp.setTime(exp.getTime() + Days*24*60*60*1000); 
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
}